/* 
 * File:   CommandParser.h
 * Author: Bram
 *
 * Created on January 11, 2013, 12:08 AM
 */

#ifndef COMMANDPARSER_H
#define	COMMANDPARSER_H

#include "Command.h"
#include "GeneralSocket.h"
#include "logger.h"
#include "base64.h"
#include <vector>
#include "Utility.h"
#include "pugixml.h"
#include "Config.h"
#include "ErrorCommand.h"
#include <queue>

class CommandParser {
public:
    
public:
    CommandParser(const string &);
    CommandParser(const CommandParser& orig);
    virtual ~CommandParser();
    Command * ParseInputCommand(const string&); //parsed een command wat binnekomt via de socket, deze moet dus van xml omgezet worden naar een command
    Command * ParseOutputCommand(const string&); //command wat jij zelf ingetypt hebt wordt geparsed, deze moet dus nog verzonden worden
    void ExcecuteReveiveCommand(TcpSocket*, Command*, queue<Command *>&);
    void ExcecuteSendCommand(TcpSocket*, Command*, queue<Command *>&);
    void ReceiveFile(TcpSocket* client, Command * cmd);
    void SendFile(TcpSocket* client, Command * cmd);
    const string& getSender();
    void getReceiver(string&);
private:
    void GenerateCommands();
    
private:
    pugi::xml_document currXMLdoc;
    string currentSender;

};

#endif	/* COMMANDPARSER_H */

